# -*- coding:utf-8 -*-
from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import List, Literal, Optional, Union
from module_admin.annotation.pydantic_annotation import as_query


class StockBasicModel(BaseModel):
    """
    表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)
    act_ent_type: Optional[str] =  Field(default=None, description='实控人企业性质')
    act_name: Optional[str] =  Field(default=None, description='实控人名称')
    area: Optional[str] =  Field(default=None, description='地域')
    cnspell: Optional[str] =  Field(default=None, description='拼音缩写')
    create_time: Optional[datetime] =  Field(default=None, description='创建时间')
    curr_type: Optional[str] =  Field(default=None, description='交易货币')
    delist_date: Optional[datetime] =  Field(default=None, description='退市日期')
    enname: Optional[str] =  Field(default=None, description='英文全称')
    exchange: Optional[str] =  Field(default=None, description='交易所代码')
    fullname: Optional[str] =  Field(default=None, description='股票全称')
    id: Optional[int] =  Field(default=None, description='ID')
    industry: Optional[str] =  Field(default=None, description='所属行业')
    is_hs: Optional[str] =  Field(default=None, description='是否沪深港通标的，N否 H沪股通 S深股通')
    list_date: Optional[datetime] =  Field(default=None, description='上市日期')
    list_status: Optional[str] =  Field(default=None, description='上市状态 L上市 D退市 P暂停上市')
    market: Optional[str] =  Field(default=None, description='市场类型（主板/创业板/科创板/CDR）')
    name: Optional[str] =  Field(default=None, description='股票名称')
    symbol: Optional[str] =  Field(default=None, description='股票代码')
    ts_code: Optional[str] =  Field(default=None, description='TS代码')
    other_info: Optional[str] = Field(default=None, description='其他信息')
    update_time: Optional[datetime] =  Field(default=None, description='更新时间')


@as_query
class StockBasicPageModel(StockBasicModel):
    """
    分页查询模型
    """
    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')